package host.skiree.nettydemo.client.service.impl;

import host.skiree.nettydemo.client.service.MessageClientHandler;
import host.skiree.nettydemo.message.GroupListResponseMessage;
import host.skiree.nettydemo.message.Message;
import io.netty.channel.ChannelHandlerContext;

import java.util.Set;

/**
 * @author anorak
 */
public class GroupList implements MessageClientHandler {
    @Override
    public void handleMessage(ChannelHandlerContext ctx, Message message) {
        GroupListResponseMessage groupListResponseMessage = (GroupListResponseMessage) message;
        Set<String> roomName = groupListResponseMessage.getGroups();
        if (roomName.isEmpty()){
            System.out.println("当前暂无聊天室");
        }else {
            System.out.println("当前存在聊天室 : " + String.join(",", roomName) );
        }
    }
}
